package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author yzq
 * @Description 供应商
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_supplier")
public class Supplier implements Serializable {

    @TableId
    private Long id;


    /** 供应商名称 */
    @ApiModelProperty(value = "供应商名称",required = true)
    @NotBlank(message = "供应商名称不能为空")
    private String supplierName;


    /** 手机号 */
    @ApiModelProperty(value = "手机号")
    private String supplierPhone;


    /** 微信号 */
    @ApiModelProperty(value = "微信号")
    private String supplierWechat;

    /** 联系地址 */
    @ApiModelProperty(value = "联系地址")
    private String supplierAddress;

    /** 状态：0：正常，1：无效 */
    @ApiModelProperty(value = "状态：0：正常，1：无效",required = true)
    @NotNull(message = "供应商状态不能为空")
    private Integer status;

    /** 供应商介绍 */
    @ApiModelProperty(value = "供应商介绍")
    private String supplierIntroduce;

    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "药房id",required = true)
    @NotNull(message = "药房id不能为空")
    private String pharmacyId;

    @ApiModelProperty(value = "红冲",required = true)
    private BigDecimal redPun;

    public void copy(Supplier source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
